package springboot.common_utils;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author daiqiang
 * @date 2022/1/16-11:27
 */
//作为springMVC的异常处理器
    //@ControllerAdvice
@RestControllerAdvice
public class  ProjectExceptionAdvice {
    //拦截所有异常信息
    @ExceptionHandler(Exception.class)
    public  R doException(Exception ex){
        //记录日志
        //通知运维
        //通知开发
       // return new  R(false,"服务器故障，请稍后再试！");
        ex.printStackTrace();
        return R.fail(false,"服务器故障，请稍后再试！");
    }
}
